Skip to content

Add a standing Gmail search filter that scopes background sync - #94

Open
nocstah wants to merge 1 commit into
tinyhumansai:mainfrom
nocstah:feat/gmail-sync-filter
Open

Add a standing Gmail search filter that scopes background sync#94
nocstah wants to merge 1 commit into
tinyhumansai:mainfrom
nocstah:feat/gmail-sync-filter

Conversation

@nocstah

@nocstah nocstah commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Adds an optional standing Gmail search filter (e.g. label:brain) that the Gmail sync pipeline ANDs onto every page fetch, so background ingestion only stores matching messages — while staying incremental. Lets a privacy-conscious host admit mail to memory by labeling it in Gmail (Gmail filters can auto-label whole categories) instead of syncing the entire inbox window.

Related issue

None here — the host-side consumer is tinyhumansai/openhuman#5730-adjacent work; an OpenHuman PR wiring [composio] gmail_sync_query through ComposioMode.gmail_sync_query follows once this merges.

API or behavior changes

Additive, non-breaking:

  • tinymemory-api: new ComposioMode.gmail_sync_query: Option<String> field (Default covers existing constructors).
  • tinymemory-core: new ComposioSyncConfig.gmail_query: Option<String>, populated by composio_config() in both modes; build_composio_pipeline() applies it to the Gmail pipeline.
  • GmailSyncPipeline::with_filter() — a standing clause composed with the incremental after:<cursor> / sync_depth_days clause. Deliberately distinct from with_query(), which keeps its existing replace semantics for backfills; a filter set alongside an override composes in front of it. With neither filter nor incremental clause, no query argument is emitted (unchanged).

Validation

Commands actually run, with their outcome:

  • cargo fmt --all -- --check — clean
  • cargo clippy -p tinymemory-api -p tinymemory-core --all-targets -- -D warnings — clean (scoped to the two changed crates)
  • cargo build --all-targets --all-features — not run in full; the two changed crates build via the clippy/test runs
  • cargo test -p tinymemory-core --lib gmail — 17 passed (4 new)

Tests

Four new tests in sync::pipelines::composio::gmail::tests pin the clause composition: filter+cursor composes (label:brain after:<ts>), filter alone scopes the first sync, no clauses ⇒ no query argument (regression guard), and with_query still replaces the cursor while composing with a filter. The e2e fixture (composio_gmail_non_tinycortex_e2e) gains the new field with None (behavior unchanged).

Documentation

Rustdoc on the new field, config field, and with_filter() (including the with_query/with_filter semantic contrast). No separate docs pages affected.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

🤖 Generated with Claude Code

https://claude.ai/code/session_01UMNxXS5ucxpzNoHnuhyQPu

A host can now pass an optional Gmail search query (e.g. 'label:brain')
that the Gmail sync pipeline ANDs onto every page fetch, so background
ingestion only stores matching messages while staying incremental:

- ComposioMode (api host config): new gmail_sync_query field for the
  host to populate from its own config.
- ComposioSyncConfig.gmail_query, plumbed through composio_config()
  and build_composio_pipeline().
- GmailSyncPipeline::with_filter(): a standing clause composed with the
  incremental after:<cursor> / sync_depth_days clause — unlike
  with_query(), which keeps its replace semantics for backfills.

Lets a privacy-conscious user admit mail to memory by labeling it in
Gmail instead of syncing the entire inbox window.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UMNxXS5ucxpzNoHnuhyQPu
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dc5cf40b-50eb-4969-9485-6bc18f808e63

Warning

Your free Security trial is over. An organization admin can activate billing to continue.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out · 426 embedded · openrouter/openai/text-embedding-3-small

@tinysweeper

tinysweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown

How this change flows

4 changed behaviours across 18 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 32 further behaviours left out to keep the diagram readable.

flowchart LR
  n0["build_composio_pipeline<br/>changed"]:::changed
  n1["composio_config<br/>changed"]:::changed
  n2["ComposioSyncConfig<br/>changed"]:::changed
  n3["...nc_completes_against_the_namespace_driver<br/>changed"]:::changed
  n4["Result"]:::impacted
  n5["run_pipeline"]:::impacted
  n6["a_held_connection_short_circuits_the_run"]:::impacted
  n7["run_composio_connection_with_caps"]:::impacted
  n8["from_workspace_dir"]:::impacted
  n9["run_gmail_backfill"]:::impacted
  n0 -->|uses| n4
  n1 -->|uses| n4
  n3 -->|uses| n2
  n3 -->|calls| n8
  n3 -->|tests| n8
  n5 -->|uses| n4
  n6 -->|calls| n5
  n6 -->|tests| n5
  n6 -->|calls| n8
  n6 -->|tests| n8
  n7 -->|calls| n0
  n7 -->|calls| n1
  n7 -->|uses| n4
  n7 -->|calls| n5
  n8 -->|uses| n4
  n9 -->|calls| n1
  n9 -->|uses| n4
  n9 -->|calls| n5
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading

Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge.

tinysweeper 0.1.0

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant